<template>
	<view>
		<view class="input">
			<input type="text" value="" v-model="newPassword" placeholder="请输入新密码">
		</view>
		<button class="btn" @click="setPassword">确定</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				newPassword:'',
				mobile:''
			}
		},
		onLoad(options) {
			if(options.mobile){
				this.mobile = options.mobile
			}
		},
		methods: {
			setPassword(){
				this.https('/login/changepwd', {
					mobile:this.mobile,
					newpassword:this.newPassword
				}).then(res => {
					uni.showToast({
						title:res.msg,
						icon:'none',
						duration:1500
					})
					setTimeout(()=>{
						uni.navigateBack({
							delta:2
						})
						
					},1000)
				}).catch(err=>{
					uni.showToast({
						title:err.msg,
						icon:'none',
						duration:1500,
						success() {
							
						}
					})
				})
			}
		}
	}
</script>

<style lang="scss">
	.input{
		width: 646rpx;
		margin: 0 auto;
		height: 100rpx;
		margin-top: 370rpx;
		border-bottom: solid 2rpx #DDE0E4;
		display: flex;
		align-items: center;
		input{
			padding: 20rpx 0rpx 0rpx 0rpx;
			margin-top: 20rpx;
			font-size: 28rpx;
			width: 80%;
			color: #222222;
		}
	}
	.btn{
		width: 630rpx;
		height: 80rpx;
		background: #00809F;
		border-radius: 16rpx;
		color: #FFF;
		margin-top: 120rpx;
		font-size: 32rpx;
		line-height: 80rpx;
		background: linear-gradient(90deg, #00809F 0%, #45BCD9 100%);
	}
</style>
